

<!DOCTYPE html>
<html lang="zh-CN" data-default-color-scheme=auto>



<head>
  <meta charset="UTF-8">
  <link rel="apple-touch-icon" sizes="76x76" href="/hello_lixi.gitee.io/img/fluid.png">
  <link rel="icon" href="/hello_lixi.gitee.io/img/fluid.png">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0, shrink-to-fit=no">
  <meta http-equiv="x-ua-compatible" content="ie=edge">
  
  <meta name="theme-color" content="#2f4154">
  <meta name="author" content="Mr.LI">
  <meta name="keywords" content="">
  
    <meta name="description" content="hexo+gitee搭建个人博客">
<meta property="og:type" content="article">
<meta property="og:title" content="Hexo+Gitee搭建个人博客">
<meta property="og:url" content="https://xistudycode.gitee.io/hello_lixi.gitee.io/2022/12/01/hexo%E6%9E%84%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/index.html">
<meta property="og:site_name" content="Welcome to the technology blog">
<meta property="og:description" content="hexo+gitee搭建个人博客">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://raw.githubusercontent.com/hellelixi/note-image01/main/images/image-20221201215807564.png">
<meta property="og:image" content="https://raw.githubusercontent.com/hellelixi/note-image01/main/images/image-20221201220022134.png">
<meta property="og:image" content="https://raw.githubusercontent.com/hellelixi/note-image01/main/images/image-20221201220618413.png">
<meta property="og:image" content="https://raw.githubusercontent.com/hellelixi/note-image01/main/images/image-20221201221802536.png">
<meta property="og:image" content="https://raw.githubusercontent.com/hellelixi/note-image01/main/images/image-20221201222435267.png">
<meta property="og:image" content="https://raw.githubusercontent.com/hellelixi/note-image01/main/images/image-20221202160542220.png">
<meta property="og:image" content="https://raw.githubusercontent.com/hellelixi/note-image01/main/images/image-20221202120326243.png">
<meta property="og:image" content="https://raw.githubusercontent.com/hellelixi/note-image01/main/images/image-20221202161206626.png">
<meta property="og:image" content="https://raw.githubusercontent.com/hellelixi/note-image01/main/images/image-20221202120810017.png">
<meta property="og:image" content="https://raw.githubusercontent.com/hellelixi/note-image01/main/images/image-20221202161900980.png">
<meta property="og:image" content="https://raw.githubusercontent.com/hellelixi/note-image01/main/images/image-20221229105351865.png">
<meta property="article:published_time" content="2022-12-01T14:32:38.483Z">
<meta property="article:modified_time" content="2022-12-29T02:54:08.829Z">
<meta property="article:author" content="Mr.LI">
<meta property="article:tag" content="hexo">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:image" content="https://raw.githubusercontent.com/hellelixi/note-image01/main/images/image-20221201215807564.png">
  
  
    <meta name="referrer" content="no-referrer-when-downgrade">
  
  
  <title>Hexo+Gitee搭建个人博客 - Welcome to the technology blog</title>

  <link  rel="stylesheet" href="https://lib.baomitu.com/twitter-bootstrap/4.6.1/css/bootstrap.min.css" />



  <link  rel="stylesheet" href="https://lib.baomitu.com/github-markdown-css/4.0.0/github-markdown.min.css" />

  <link  rel="stylesheet" href="https://lib.baomitu.com/hint.css/2.7.0/hint.min.css" />

  <link  rel="stylesheet" href="https://lib.baomitu.com/fancybox/3.5.7/jquery.fancybox.min.css" />



<!-- 主题依赖的图标库，不要自行修改 -->
<!-- Do not modify the link that theme dependent icons -->

<link rel="stylesheet" href="//at.alicdn.com/t/font_1749284_hj8rtnfg7um.css">



<link rel="stylesheet" href="//at.alicdn.com/t/font_1736178_lbnruvf0jn.css">


<link  rel="stylesheet" href="/hello_lixi.gitee.io/css/main.css" />


  <link id="highlight-css" rel="stylesheet" href="/hello_lixi.gitee.io/css/highlight.css" />
  
    <link id="highlight-css-dark" rel="stylesheet" href="/hello_lixi.gitee.io/css/highlight-dark.css" />
  




  <script id="fluid-configs">
    var Fluid = window.Fluid || {};
    Fluid.ctx = Object.assign({}, Fluid.ctx)
    var CONFIG = {"hostname":"xistudycode.gitee.io","root":"/hello_lixi.gitee.io/","version":"1.9.3","typing":{"enable":true,"typeSpeed":70,"cursorChar":"_","loop":false,"scope":[]},"anchorjs":{"enable":true,"element":"h1,h2,h3,h4,h5,h6","placement":"left","visible":"hover","icon":""},"progressbar":{"enable":true,"height_px":3,"color":"#29d","options":{"showSpinner":false,"trickleSpeed":100}},"code_language":{"enable":true,"default":"TEXT"},"copy_btn":true,"image_caption":{"enable":true},"image_zoom":{"enable":true,"img_url_replace":["",""]},"toc":{"enable":true,"placement":"right","headingSelector":"h1,h2,h3,h4,h5,h6","collapseDepth":0},"lazyload":{"enable":true,"loading_img":"/img/loading.gif","onlypost":false,"offset_factor":2},"web_analytics":{"enable":true,"follow_dnt":true,"baidu":null,"google":null,"gtag":null,"tencent":{"sid":null,"cid":null},"woyaola":null,"cnzz":null,"leancloud":{"app_id":null,"app_key":null,"server_url":null,"path":"window.location.pathname","ignore_local":false}},"search_path":"/hello_lixi.gitee.io/local-search.xml"};

    if (CONFIG.web_analytics.follow_dnt) {
      var dntVal = navigator.doNotTrack || window.doNotTrack || navigator.msDoNotTrack;
      Fluid.ctx.dnt = dntVal && (dntVal.startsWith('1') || dntVal.startsWith('yes') || dntVal.startsWith('on'));
    }
  </script>
  <script  src="/hello_lixi.gitee.io/js/utils.js" ></script>
  <script  src="/hello_lixi.gitee.io/js/color-schema.js" ></script>
  

  

  

  

  

  

  

  



  
<meta name="generator" content="Hexo 5.4.2"></head>


<body>
  

  <header>
    

<div class="header-inner" style="height: 70vh;">
  <nav id="navbar" class="navbar fixed-top  navbar-expand-lg navbar-dark scrolling-navbar">
  <div class="container">
    <a class="navbar-brand" href="/hello_lixi.gitee.io/">
      <strong>xBlog</strong>
    </a>

    <button id="navbar-toggler-btn" class="navbar-toggler" type="button" data-toggle="collapse"
            data-target="#navbarSupportedContent"
            aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
      <div class="animated-icon"><span></span><span></span><span></span></div>
    </button>

    <!-- Collapsible content -->
    <div class="collapse navbar-collapse" id="navbarSupportedContent">
      <ul class="navbar-nav ml-auto text-center">
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/hello_lixi.gitee.io/">
                <i class="iconfont icon-home-fill"></i>
                首页
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/hello_lixi.gitee.io/archives/">
                <i class="iconfont icon-archive-fill"></i>
                归档
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/hello_lixi.gitee.io/categories/">
                <i class="iconfont icon-category-fill"></i>
                分类
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/hello_lixi.gitee.io/tags/">
                <i class="iconfont icon-tags-fill"></i>
                标签
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/hello_lixi.gitee.io/about/">
                <i class="iconfont icon-user-fill"></i>
                关于
              </a>
            </li>
          
        
        
          <li class="nav-item" id="search-btn">
            <a class="nav-link" target="_self" href="javascript:;" data-toggle="modal" data-target="#modalSearch" aria-label="Search">
              &nbsp;<i class="iconfont icon-search"></i>&nbsp;
            </a>
          </li>
          
        
        
          <li class="nav-item" id="color-toggle-btn">
            <a class="nav-link" target="_self" href="javascript:;" aria-label="Color Toggle">&nbsp;<i
                class="iconfont icon-dark" id="color-toggle-icon"></i>&nbsp;</a>
          </li>
        
      </ul>
    </div>
  </div>
</nav>

  

<div id="banner" class="banner" parallax=true
     style="background: url('/hello_lixi.gitee.io/img/default.png') no-repeat center center; background-size: cover;">
  <div class="full-bg-img">
    <div class="mask flex-center" style="background-color: rgba(0, 0, 0, 0.3)">
      <div class="banner-text text-center fade-in-up">
        <div class="h2">
          
            <span id="subtitle" data-typed-text="Hexo+Gitee搭建个人博客"></span>
          
        </div>

        
          
  <div class="mt-3">
    
      <span class="post-meta mr-2">
        <i class="iconfont icon-author" aria-hidden="true"></i>
        Mr.LI
      </span>
    
    
      <span class="post-meta">
        <i class="iconfont icon-date-fill" aria-hidden="true"></i>
        <time datetime="2022-12-01 22:32" pubdate>
          2022年12月1日 晚上
        </time>
      </span>
    
  </div>

  <div class="mt-1">
    
      <span class="post-meta mr-2">
        <i class="iconfont icon-chart"></i>
        
          3.8k 字
        
      </span>
    

    
      <span class="post-meta mr-2">
        <i class="iconfont icon-clock-fill"></i>
        
        
        
          32 分钟
        
      </span>
    

    
    
      
        <span id="busuanzi_container_page_pv" style="display: none">
          <i class="iconfont icon-eye" aria-hidden="true"></i>
          <span id="busuanzi_value_page_pv"></span> 次
        </span>
        
      
    
  </div>


        
      </div>

      
    </div>
  </div>
</div>

</div>

  </header>

  <main>
    
      

<div class="container-fluid nopadding-x">
  <div class="row nomargin-x">
    <div class="side-col d-none d-lg-block col-lg-2">
      

    </div>

    <div class="col-lg-8 nopadding-x-md">
      <div class="container nopadding-x-md" id="board-ctn">
        <div id="board">
          <article class="post-content mx-auto">
            <!-- SEO header -->
            <h1 style="display: none">Hexo+Gitee搭建个人博客</h1>
            
              <p class="note note-info">
                
                  
                    本文最后更新于：2022年12月29日 上午
                  
                
              </p>
            
            
              <div class="markdown-body">
                
                <h2 id="前言"><a href="#前言" class="headerlink" title="前言"></a>前言</h2><p>在学习Java开发的时候，经常记录一些笔记，但是这些笔记存储在本地，一旦自己的电脑不在身边，有些东西记不得又要去重新搜索，很麻烦，因此，搭建一个自己的博客，记录一下自己学习过程中碰到的问题和解决办法，方便回顾复习！个人博客使用Hexo+Gitee，后面使用hexo主题进行美化，附最终成果<a href="https://xistudycode.gitee.io/hello_lixi.gitee.io">https://xistudycode.gitee.io/hello_lixi.gitee.io</a></p>
<p>在建博客的过程中，使用GitHub和Gitee基本操作都是一样的，但是GitHub访问比较慢，因此最终还是选择了Gitee，希望Gitee后面不会中国特色的收费吧。</p>
<h2 id="安装并配置Nodejs"><a href="#安装并配置Nodejs" class="headerlink" title="安装并配置Nodejs"></a>安装并配置Nodejs</h2><p>Node.js下载：<strong><a target="_blank" rel="noopener" href="https://nodejs.org/en/download/">https://nodejs.org/en/download/</a></strong></p>
<ol>
<li>下载msi安装包，开始安装，一路next即可；</li>
</ol>
<p>在cmd中测试是否能安装完成，</p>
<p>node -v   显示版本说明安装成功；</p>
<p>npm -v 显示版本说明自带的npm也安装成功；</p>
<p>新版的Node.js已自带npm，安装Node.js时会一起安装，npm的作用就是对Node.js依赖的包进行管理，也可以理解为用来安装/卸载Node.js需要装的东西。</p>
<ol start="2">
<li><p>配置环境变量</p>
<p>（1）找到安装nodejs的路径</p>
<p>（2） 新增 node_global 和 node_cache 文件夹</p>
<img src="https://raw.githubusercontent.com/hellelixi/note-image01/main/images/image-20221201215807564.png" srcset="/hello_lixi.gitee.io/img/loading.gif" lazyload alt="image-20221201215807564" style="zoom: 80%;" /></li>
</ol>
<p>​    （3）在node_global文件夹里面再新建文件夹</p>
<p><img src="https://raw.githubusercontent.com/hellelixi/note-image01/main/images/image-20221201220022134.png" srcset="/hello_lixi.gitee.io/img/loading.gif" lazyload alt="image-20221201220022134"></p>
<p>（4）创建完两个空文件夹之后，打开cmd命令窗口，输入</p>
<figure class="highlight cmd"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><code class="hljs cmd">npm config <span class="hljs-built_in">set</span> prefix &quot;D:\Programs\nodejs\node_global&quot;<br>npm config <span class="hljs-built_in">set</span> cache &quot;D:\Programs\nodejs\nnode_cache&quot;<br></code></pre></td></tr></table></figure>

<p>（5）电脑环境变量，</p>
<p>用户变量，在Path里面增加      D:\Programs\nodejs\node_global</p>
<p>系统变量：</p>
<p>变量名：NODE_PATH</p>
<p>值：D:\Programs\nodejs\node_global\node_modules</p>
<img src="https://raw.githubusercontent.com/hellelixi/note-image01/main/images/image-20221201220618413.png" srcset="/hello_lixi.gitee.io/img/loading.gif" lazyload alt="image-20221201220618413" style="zoom:80%;" />



<h2 id="Hexo安装"><a href="#Hexo安装" class="headerlink" title="Hexo安装"></a>Hexo安装</h2><figure class="highlight cmd"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><code class="hljs cmd"># 全局安装<br>npm install hexo-cli -g<br># 查看hexo的版本<br>hexo -v<br></code></pre></td></tr></table></figure>

<p>如果出现错误，尝试</p>
<figure class="highlight cmd"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs cmd">cnpm install hexo-cli -g<br></code></pre></td></tr></table></figure>



<h2 id="安装并配置Git"><a href="#安装并配置Git" class="headerlink" title="安装并配置Git"></a>安装并配置Git</h2><p>下载git，安装</p>
<p>Git安装教程：</p>
<p><a target="_blank" rel="noopener" href="https://www.bilibili.com/video/BV1FE411P7B3/?spm_id_from=333.1007.top_right_bar_window_custom_collection.content.click&amp;vd_source=557547c5067fdc048e1e4d8565fba06b">https://www.bilibili.com/video/BV1FE411P7B3/?spm_id_from=333.1007.top_right_bar_window_custom_collection.content.click&amp;vd_source=557547c5067fdc048e1e4d8565fba06b</a></p>
<p>安装完成配置Git</p>
<p>当你安装Git后首先要做的事情是设置你的用户名称和e-mail地址。这是非常重要的，因为每 次Git提交都会使用该信息。它被永远的嵌入到了你的提交中</p>
<figure class="highlight cmd"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><code class="hljs cmd">git config --global user.name &quot;xixix&quot;  #名称<br>git config --global user.email <span class="hljs-number">24736743</span>@qq.com #邮箱<br></code></pre></td></tr></table></figure>

<p>设置本机绑定SSH公钥，实现免密码登录！（免密码登录，这一步挺重要的，码云是远程 仓库，我们是平时工作在本地仓库！)</p>
<figure class="highlight cmd"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><code class="hljs cmd"><span class="hljs-number">1</span>   #进入 C:\Users\Administrator\.ssh 目录<br><span class="hljs-number">2</span>   # 生成公钥<br><span class="hljs-number">3</span>   ssh-keygen -t rsa<br></code></pre></td></tr></table></figure>

<p><img src="https://raw.githubusercontent.com/hellelixi/note-image01/main/images/image-20221201221802536.png" srcset="/hello_lixi.gitee.io/img/loading.gif" lazyload alt="image-20221201221802536"></p>
<p>将文件里面的代码复制，添加到Gitee的账户中去，设置，ssh公钥</p>
<h2 id="本地访问博客"><a href="#本地访问博客" class="headerlink" title="本地访问博客"></a>本地访问博客</h2><p>1、创建一个名为 Blog 的文件，在里面启用 Git Bash Here</p>
<p>2、初始化hexo</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs git">hexo init<br></code></pre></td></tr></table></figure>

<p>注意这里可能会出现错误，依赖无法导入，再输入npm install会出现error，这个问题找了好多办法都不行。</p>
<p><img src="https://raw.githubusercontent.com/hellelixi/note-image01/main/images/image-20221201222435267.png" srcset="/hello_lixi.gitee.io/img/loading.gif" lazyload alt="image-20221201222435267"></p>
<p>解决：设置淘宝镜像加速</p>
<p>退出这个地方，在其他Blog的根目录git bash</p>
<figure class="highlight cmd"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs cmd">npm install -g cnpm --registry=https://registry.npm.taobao.org<br></code></pre></td></tr></table></figure>

<p>或者用cmd命令进行安装。完成之后遇到npm出错的情况，将npm换成cnpm，其他命令都是一样的</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><code class="hljs git">hexo init<br><br>cnpm install<br></code></pre></td></tr></table></figure>

<p>安装Hexo部署插件</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs git">npm install hexo-deployer-git --save<br></code></pre></td></tr></table></figure>

<p>3、生成本地的hexo页面</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs git">hexo s<br></code></pre></td></tr></table></figure>

<p>4、访问</p>
<p>打开本地服务器</p>
<figure class="highlight http"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs http">http://localhost:4000/<br></code></pre></td></tr></table></figure>

<p>5、长按ctrl+c关闭服务器</p>
<h2 id="上传到Gitee"><a href="#上传到Gitee" class="headerlink" title="上传到Gitee"></a>上传到Gitee</h2><p>1、在Gitee上新建一个仓库，设置为开源，勾选使用readme文件</p>
<p><img src="https://raw.githubusercontent.com/hellelixi/note-image01/main/images/image-20221202160542220.png" srcset="/hello_lixi.gitee.io/img/loading.gif" lazyload alt="image-20221202160542220"></p>
<p>2、修改Blog根目录下面的-config.yml文件，找到deploy配置：</p>
<figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><code class="hljs xml">#第16行代码，url后面的地址换成你自己的博客地址<br>url: https://xistudycode.gitee.io/hello_lixi.gitee.io<br>#文件底部<br>deploy:<br>  type: git<br>  repository: 你的github地址<br>  branch: main<br></code></pre></td></tr></table></figure>

<p><img src="https://raw.githubusercontent.com/hellelixi/note-image01/main/images/image-20221202120326243.png" srcset="/hello_lixi.gitee.io/img/loading.gif" lazyload alt="image-20221202120326243"></p>
<p>3、安装hexo-deployer-git 自动部署发布工具，上面已经安装过了。</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs git">npm install hexo-deployer-git --save<br></code></pre></td></tr></table></figure>

<p>4、生成页面</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs git">hexo g<br></code></pre></td></tr></table></figure>

<p>5、部署到gitee服务器，此时本地文件夹中出现有一个public文件夹</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs git">hexo d<br></code></pre></td></tr></table></figure>

<p>6、开启Gitee Pages 静态网页托管服务</p>
<p>点击仓库上方的 “服务”，选择gitee pages，强制使用https，更新，会出现静态网页的访问地址。之后每次新发布博客或者修改博客的内容都需要从新部署—更新。</p>
<p><img src="https://raw.githubusercontent.com/hellelixi/note-image01/main/images/image-20221202161206626.png" srcset="/hello_lixi.gitee.io/img/loading.gif" lazyload alt="image-20221202161206626"></p>
<h2 id="撰写博客"><a href="#撰写博客" class="headerlink" title="撰写博客"></a>撰写博客</h2><p>使用Typora写本地博客，之后部署发布</p>
<p><img src="https://raw.githubusercontent.com/hellelixi/note-image01/main/images/image-20221202120810017.png" srcset="/hello_lixi.gitee.io/img/loading.gif" lazyload alt="image-20221202120810017"></p>
<ul>
<li><code>_config.yml</code>：俗称站点配置文件，很多与博客网站的格式、内容相关的设置都需要在里面改。</li>
<li><code>node_modules</code>: 存储Hexo插件的文件，可以实现各种扩展功能。一般不需要管。</li>
<li><code>package.json</code>：</li>
<li><code>scaffolds</code>：模板文件夹，里面的<code>post.md</code>文件可以设置每一篇博客的模板。具体用起来就知道能干嘛了。</li>
<li><code>source</code>：非常重要。所有的个人文件都在里面，<code>source</code>文件夹下默认只有一个子文件夹——<code>_posts</code>。我们写的博客都放在这个子文件夹里面！</li>
<li><code>themes</code>：主题文件夹，可以从<a target="_blank" rel="noopener" href="https://hexo.io/themes/">Hexo主题官网</a>或者网上大神的Github主页下载各种各样美观的主题，让自己的网站变得逼格高端的关键！</li>
</ul>
<p>新建一篇名为 hello world  的文章</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs git">hexo new &quot;hello world&quot;<br></code></pre></td></tr></table></figure>

<p>之后，就可以直接编辑刚刚新建的文章，再次启动服务查看效果，如下，这里有一个问题，Hexo框 架文章中的图片只支持外链的形式，有很多方法解决，比如，可以在码云或者七牛云部署一个自己的图床。</p>
<p>新建文章时每次都要执行 hexo new “blogName” 命令很麻烦，可以直接到根目录 /source/_posts 目录下，创建一个.md 文件进行编写，在文件的顶部添加下面内容就 可以了，主要写一个 title 就好了，其他都可以省略</p>
<figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><code class="hljs yaml"><span class="hljs-attr">title:</span> <span class="hljs-string">文章名称</span><br><span class="hljs-attr">date:</span> <span class="hljs-number">2020-07-30 16:46:07</span><span class="hljs-string">(创建时间)</span> <span class="hljs-attr">tags:</span> <span class="hljs-string">标签名</span><br><span class="hljs-attr">categories:</span> <span class="hljs-string">分类</span> <span class="hljs-attr">description:</span> <span class="hljs-string">描述</span><br><span class="hljs-attr">comments:</span> <span class="hljs-string">是否开启评论(true</span> <span class="hljs-string">or</span> <span class="hljs-literal">false</span><span class="hljs-string">)</span><br><span class="hljs-comment">##注意里面的标点符号都需要英文，之后加空格</span><br></code></pre></td></tr></table></figure>

<p>之后，使用 hexo g –d 命令推送到 gitee上，并在 gitee 上更新一下 Gitee Pages 服务即可。</p>
<h2 id="修改主题"><a href="#修改主题" class="headerlink" title="修改主题"></a>修改主题</h2><p>官网主题：<a target="_blank" rel="noopener" href="https://hexo.io/themes/">https://hexo.io/themes/</a></p>
<p>可以去官网找自己喜欢的主题，下载下来，注意有的需要下载文件，有可以通过命令行来进行安装，github上面的主题都有安装教程，一定要阅读作者的安装教程，最大限度的融合到自己的博客。</p>
<p>1、进入所下载主题根目录下的 theme 目录（有的主题下载下来本身就是theme），将里面的文件复制到自己项目的 theme 目录下（有的主题需要改名字）</p>
<p>2、修改根目录下的配置文件 _config.yml，修改theme：主题名字 </p>
<p><img src="https://raw.githubusercontent.com/hellelixi/note-image01/main/images/image-20221202161900980.png" srcset="/hello_lixi.gitee.io/img/loading.gif" lazyload alt="image-20221202161900980"></p>
<p>3、在Blog根目录下新建主题配置文件，例如config.fluid.yml（命名规则config.主题名.yml），将Blog根目录 _config.yml文件里面的内容复制粘贴到config.fluid.yml配置文件中，并且将主题的配置文件中的内容复制粘贴到config.fluid.yml配置文件中（做到这一步才能让主题的配置生效，并且可以修改主题的相关属性，不然修改主题的相关配置是不生效的，这一问题我找了好久）</p>
<p><img src="https://raw.githubusercontent.com/hellelixi/note-image01/main/images/image-20221229105351865.png" srcset="/hello_lixi.gitee.io/img/loading.gif" lazyload alt="image-20221229105351865"></p>
<p>4、启动项目，先访问本地静态页面是否加载成功。</p>
<figure class="highlight nginx"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><code class="hljs nginx"><span class="hljs-attribute">hexo</span> g  <span class="hljs-comment">#生成静态页面资源</span><br><br>hexo s  <span class="hljs-comment">#发布到本地服务器，启动服务器</span><br></code></pre></td></tr></table></figure>

<p>5、将修改后的项目部署到远程仓库</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><code class="hljs git"># 生成静态网站文件<br>hexo g<br># 上传到远程仓库<br>hexo d<br><br># 清除hexo的缓存<br>hexo clean<br># 采用一键部署<br>hexo g --d<br></code></pre></td></tr></table></figure>

<p>6、部署成功后更新Gitee Page服务，访问<a href="https://xistudycode.gitee.io/hello_lixi.gitee.io">https://xistudycode.gitee.io/hello_lixi.gitee.io</a> 主题样式部署成功。</p>
<h2 id="最后"><a href="#最后" class="headerlink" title="最后"></a>最后</h2><p>发布博客的命令汇总</p>
<figure class="highlight nginx"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><code class="hljs nginx"><span class="hljs-attribute">hexo</span> clean <span class="hljs-comment">#清理hexo缓存</span><br>hexo g   <span class="hljs-comment">#生成静态页面</span><br>hexo s   <span class="hljs-comment">#部署到本地服务器并开启</span><br><span class="hljs-comment">#ctrl+c退出服务器</span><br>hexo d  <span class="hljs-comment">#部署到gitee服务器</span><br></code></pre></td></tr></table></figure>

<p>感谢大佬奉献的学习教程：</p>
<p><a target="_blank" rel="noopener" href="https://wushishu.xyz/post/be8880ea.html">https://wushishu.xyz/post/be8880ea.html</a></p>

                
              </div>
            
            <hr/>
            <div>
              <div class="post-metas my-3">
  
    <div class="post-meta mr-3 d-flex align-items-center">
      <i class="iconfont icon-category"></i>
      

<span class="category-chains">
  
  
    
      <span class="category-chain">
        
  <a href="/hello_lixi.gitee.io/categories/java%E5%BC%80%E5%8F%91/" class="category-chain-item">java开发</a>
  
  

      </span>
    
  
</span>

    </div>
  
  
    <div class="post-meta">
      <i class="iconfont icon-tags"></i>
      
        <a href="/hello_lixi.gitee.io/tags/hexo/">#hexo</a>
      
    </div>
  
</div>


              
  

  <div class="license-box my-3">
    <div class="license-title">
      <div>Hexo+Gitee搭建个人博客</div>
      <div>https://xistudycode.gitee.io/hello_lixi.gitee.io/2022/12/01/hexo构建个人博客/</div>
    </div>
    <div class="license-meta">
      
        <div class="license-meta-item">
          <div>作者</div>
          <div>Mr.LI</div>
        </div>
      
      
        <div class="license-meta-item license-meta-date">
          <div>发布于</div>
          <div>2022年12月1日</div>
        </div>
      
      
      
        <div class="license-meta-item">
          <div>许可协议</div>
          <div>
            
              
              
                <a target="_blank" href="https://creativecommons.org/licenses/by/4.0/">
                  <span class="hint--top hint--rounded" aria-label="BY - 署名">
                    <i class="iconfont icon-by"></i>
                  </span>
                </a>
              
            
          </div>
        </div>
      
    </div>
    <div class="license-icon iconfont"></div>
  </div>



              
                <div class="post-prevnext my-3">
                  <article class="post-prev col-6">
                    
                    
                      <a href="/hello_lixi.gitee.io/2022/12/06/maven%E9%97%AE%E9%A2%98/" title="记录在开发过程中 Maven 出现的各种问题">
                        <i class="iconfont icon-arrowleft"></i>
                        <span class="hidden-mobile">记录在开发过程中 Maven 出现的各种问题</span>
                        <span class="visible-mobile">上一篇</span>
                      </a>
                    
                  </article>
                  <article class="post-next col-6">
                    
                    
                      <a href="/hello_lixi.gitee.io/2022/12/01/hello-world/" title="Hello Hexo">
                        <span class="hidden-mobile">Hello Hexo</span>
                        <span class="visible-mobile">下一篇</span>
                        <i class="iconfont icon-arrowright"></i>
                      </a>
                    
                  </article>
                </div>
              
            </div>

            
          </article>
        </div>
      </div>
    </div>

    <div class="side-col d-none d-lg-block col-lg-2">
      
  <aside class="sidebar" style="margin-left: -1rem">
    <div id="toc">
  <p class="toc-header"><i class="iconfont icon-list"></i>&nbsp;目录</p>
  <div class="toc-body" id="toc-body"></div>
</div>



  </aside>


    </div>
  </div>
</div>





  



  



  



  



  







    

    
      <a id="scroll-top-button" aria-label="TOP" href="#" role="button">
        <i class="iconfont icon-arrowup" aria-hidden="true"></i>
      </a>
    

    
      <div class="modal fade" id="modalSearch" tabindex="-1" role="dialog" aria-labelledby="ModalLabel"
     aria-hidden="true">
  <div class="modal-dialog modal-dialog-scrollable modal-lg" role="document">
    <div class="modal-content">
      <div class="modal-header text-center">
        <h4 class="modal-title w-100 font-weight-bold">搜索</h4>
        <button type="button" id="local-search-close" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body mx-3">
        <div class="md-form mb-5">
          <input type="text" id="local-search-input" class="form-control validate">
          <label data-error="x" data-success="v" for="local-search-input">关键词</label>
        </div>
        <div class="list-group" id="local-search-result"></div>
      </div>
    </div>
  </div>
</div>

    

    
  </main>

  <footer>
    <div class="footer-inner">
  
    <div class="footer-content">
       <a href="https://hexo.io" target="_blank" rel="nofollow noopener"><span>xBolg</span></a> <i class="iconfont icon-love"></i> <a href="https://github.com/fluid-dev/hexo-theme-fluid" target="_blank" rel="nofollow noopener"><span>@Fluid</span></a> 
    </div>
  
  
    <div class="statistics">
  
  

  
    
      <span id="busuanzi_container_site_pv" style="display: none">
        总访问量 
        <span id="busuanzi_value_site_pv"></span>
         次
      </span>
    
    
      <span id="busuanzi_container_site_uv" style="display: none">
        总访客数 
        <span id="busuanzi_value_site_uv"></span>
         人
      </span>
    
    
  
</div>

  
  
  
</div>

  </footer>

  <!-- Scripts -->
  
  <script  src="https://lib.baomitu.com/nprogress/0.2.0/nprogress.min.js" ></script>
  <link  rel="stylesheet" href="https://lib.baomitu.com/nprogress/0.2.0/nprogress.min.css" />

  <script>
    NProgress.configure({"showSpinner":false,"trickleSpeed":100})
    NProgress.start()
    window.addEventListener('load', function() {
      NProgress.done();
    })
  </script>


<script  src="https://lib.baomitu.com/jquery/3.6.0/jquery.min.js" ></script>
<script  src="https://lib.baomitu.com/twitter-bootstrap/4.6.1/js/bootstrap.min.js" ></script>
<script  src="/hello_lixi.gitee.io/js/events.js" ></script>
<script  src="/hello_lixi.gitee.io/js/plugins.js" ></script>


  <script  src="https://lib.baomitu.com/typed.js/2.0.12/typed.min.js" ></script>
  <script>
    (function (window, document) {
      var typing = Fluid.plugins.typing;
      var subtitle = document.getElementById('subtitle');
      if (!subtitle || !typing) {
        return;
      }
      var text = subtitle.getAttribute('data-typed-text');
      
        typing(text);
      
    })(window, document);
  </script>




  
    <script  src="/hello_lixi.gitee.io/js/img-lazyload.js" ></script>
  




  
<script>
  Fluid.utils.createScript('https://lib.baomitu.com/tocbot/4.18.2/tocbot.min.js', function() {
    var toc = jQuery('#toc');
    if (toc.length === 0 || !window.tocbot) { return; }
    var boardCtn = jQuery('#board-ctn');
    var boardTop = boardCtn.offset().top;

    window.tocbot.init(Object.assign({
      tocSelector     : '#toc-body',
      contentSelector : '.markdown-body',
      linkClass       : 'tocbot-link',
      activeLinkClass : 'tocbot-active-link',
      listClass       : 'tocbot-list',
      isCollapsedClass: 'tocbot-is-collapsed',
      collapsibleClass: 'tocbot-is-collapsible',
      scrollSmooth    : true,
      includeTitleTags: true,
      headingsOffset  : -boardTop,
    }, CONFIG.toc));
    if (toc.find('.toc-list-item').length > 0) {
      toc.css('visibility', 'visible');
    }

    Fluid.events.registerRefreshCallback(function() {
      if ('tocbot' in window) {
        tocbot.refresh();
        var toc = jQuery('#toc');
        if (toc.length === 0 || !tocbot) {
          return;
        }
        if (toc.find('.toc-list-item').length > 0) {
          toc.css('visibility', 'visible');
        }
      }
    });
  });
</script>


  <script src=https://lib.baomitu.com/clipboard.js/2.0.11/clipboard.min.js></script>

  <script>Fluid.plugins.codeWidget();</script>


  
<script>
  Fluid.utils.createScript('https://lib.baomitu.com/anchor-js/4.3.1/anchor.min.js', function() {
    window.anchors.options = {
      placement: CONFIG.anchorjs.placement,
      visible  : CONFIG.anchorjs.visible
    };
    if (CONFIG.anchorjs.icon) {
      window.anchors.options.icon = CONFIG.anchorjs.icon;
    }
    var el = (CONFIG.anchorjs.element || 'h1,h2,h3,h4,h5,h6').split(',');
    var res = [];
    for (var item of el) {
      res.push('.markdown-body > ' + item.trim());
    }
    if (CONFIG.anchorjs.placement === 'left') {
      window.anchors.options.class = 'anchorjs-link-left';
    }
    window.anchors.add(res.join(', '));

    Fluid.events.registerRefreshCallback(function() {
      if ('anchors' in window) {
        anchors.removeAll();
        var el = (CONFIG.anchorjs.element || 'h1,h2,h3,h4,h5,h6').split(',');
        var res = [];
        for (var item of el) {
          res.push('.markdown-body > ' + item.trim());
        }
        if (CONFIG.anchorjs.placement === 'left') {
          anchors.options.class = 'anchorjs-link-left';
        }
        anchors.add(res.join(', '));
      }
    });
  });
</script>


  
<script>
  Fluid.utils.createScript('https://lib.baomitu.com/fancybox/3.5.7/jquery.fancybox.min.js', function() {
    Fluid.plugins.fancyBox();
  });
</script>


  <script>Fluid.plugins.imageCaption();</script>

  <script  src="/hello_lixi.gitee.io/js/local-search.js" ></script>

  <script defer src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js" ></script>





<!-- 主题的启动项，将它保持在最底部 -->
<!-- the boot of the theme, keep it at the bottom -->
<script  src="/hello_lixi.gitee.io/js/boot.js" ></script>


  

  <noscript>
    <div class="noscript-warning">博客在允许 JavaScript 运行的环境下浏览效果更佳</div>
  </noscript>
</body>
</html>
